https://leetcode.cn/problems/existence-of-a-substring-in-a-string-and-its-reverse/submissions/512892940/


class Solution {
public:
    bool isSubstringPresent(string s) {

        unordered_map<string, int> mymap;


        for (int i = 0; i < s.size() - 1; i++)
        {

            string str = s.substr(i, 2);
            mymap[str]++;
        }

        bool flag = false;
        for (int i = 0; i < s.size() - 1; i++)
        {

            string str1 = s.substr(i, 2);
            reverse(str1.begin(), str1.end());

            if (mymap[str1] >= 1)
            {
                flag = true;
                break;
            }
        }
        return flag;

    }
};